<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="../aaa/css/font.css">
    <link rel="stylesheet" href="../aaa/css/xadmin.css">
    <script src="../aaa/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../aaa/js/xadmin.js"></script>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form">
                <div class="layui-form-item">
                    <label class="layui-form-label">所属仓库</label>
                    <div class="layui-input-inline" >
                    <select  name="entrepotid" class="form-control" id="entrepotid" disabled>
                        <option th:each="Ins:${Ins}"
                                th:value="${Ins.entrepotid}"
                                th:text="${Ins.entrepot.entrepotname}"></option>
                    </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">商品订单号</label>
                    <div class="layui-input-inline" >
                    <select  name="ordersId" class="form-control" id="ordersId" disabled>
                        <option th:each="Ins:${Ins}"
                                th:value="${Ins.ordersId}"
                                th:text="${Ins.ordersId}"
                        ></option>
                    </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">入库订单号</label>
                    <div class="layui-input-inline" >
                    <select  name="sparId" class="form-control" id="sparId" disabled>
                        <option th:each="Ins:${Ins}"
                                th:value="${Ins.Instorageid}"
                                th:text="${Ins.Instorageid}"
                        ></option>
                    </select>
                    </div>
                </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">备注</label>
                <div class="layui-input-block">
                    <textarea name="bz" placeholder="请输入内容" class="layui-textarea"></textarea>
                </div>
            </div>
                <div class="layui-form-item">
                    <button  class="layui-btn" lay-filter="add" lay-submit="">
                        出库
                    </button>
                </div>
        </form>
    </div>
</div>
</body>
</html>
<script>
    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var form = layui.form;
        form.render('select');
        form.on('submit(add)',
            function(data) {
                console.log(data.field);
                var datas=data.field;
                if (datas.status=="on"){
                    datas.status=0;//正常状态
                }else {
                    datas.status=1;
                }
                $.ajax({
                    url: "/Ins/add",
                    type: "POST",
                    data:datas,
                    success: function (result) {

                        if (result.code==200){
                            layer.msg("添加失败");
                        }
                        else {
                            layer.msg("添加成功",{
                                icon: 6,
                                time:500
                            },function() {
                                parent.window.location.reload();//重新页面
                                // 获得frame索引
                                var index = parent.layer.getFrameIndex(window.name);
                                //关闭当前frame
                                parent.layer.close(index);
                            });
                        }
                    }
                });
                return false;
            });
        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });

</script>
